package persistence;

import java.util.Map;
import java.util.Set;

import model.entity.Product;
import model.entity.container.ProductContainer;

import common.Result;
import common.ValueResult;

/**
 * @author Trevor Dixon
 * 
 *         An object that provides access to a data store.
 * 
 * @param <Entity>
 *          The data transfer object type used to shuttle data to and from this data access object.
 */
public interface ProductsDAO
{
  /**
   * @return A Result indicating whether the operation was successful, attached to which is set of
   *         all entity data transfer objects in the data store.
   */
  public common.ValueResult<java.util.Set<Product>> getAll();

  public ValueResult<Map<ProductContainer, Set<Product>>> getProductsByContainer();

  /**
   * Adds an entity to the data store.
   * 
   * @param dto
   * @return A Result indicating whether the operation was completed successfully.
   */
  public Result add(Product product);

  /**
   * Updates an entity in the data store.
   * 
   * @param dto
   * @return A Result indicating whether the operation was completed successfully.
   */
  public Result update(Product product);

  /**
   * Removes an entity from the data store.
   * 
   * @param dto
   * @return A Result indicating whether the operation was completed successfully.
   */
  public Result delete(Product product);
  
  public Result addToProductContainer(Product product, ProductContainer container);

  public Result saveProducts(java.util.Set<Product> products);

  public Result saveProductsByContainer(Map<ProductContainer, Set<Product>> productsByContainer);
}
